package day21;

import java.util.Scanner;

/**
 * MP3光标位置
 */

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main1 {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int amount = scanner.nextInt();
        String ud = scanner.next();

        int lift = 1;
        int right = Math.min(amount,4);
        int index = 1;

        for (int i = 0; i < ud.length(); i++) {
            if (ud.charAt(i) == 'U' && index == 1) {
                index = amount;
                lift = amount > 4 ? amount - 3 : 1;
                right = amount;
            } else if (ud.charAt(i) == 'D' && index == amount) {
                index = 1;
                lift = 1;
                right = Math.min(amount, 4);
            } else {
                index = ud.charAt(i) == 'U' ? index - 1 : index + 1;
                if (index < lift) {
                    lift = index;
                    right = amount > 4 ? lift + 3 : amount;
                } else if (index > right) {
                    right = index;
                    lift = amount > 4 ? right - 3 : 1;
                }
            }
        }
        for (int i = lift; i <= right; i++) {
            System.out.print(i + " ");
        }
        System.out.println();
        System.out.println(index);

    }
}